<template>
	<view class="user_set">
		<view class="set_item" v-for="(item, index) in setList" :key="index" @click="onChange(item)">
			<view class="item" v-if="!item.show">
				<view class="left">
					<view class="set_icon">
						<text class="iconfont" :class="item.icon"></text>
					</view>
					<view class="set_title">
						{{ item.title }}
					</view>
				</view>
				<view class="set_iconright">
					<text class="iconfont icon-jiantou"></text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				setList: [
					{ icon: "icon-cardb", title: "诚信保证金", route: "/pages/baozhengjin/baozhengjin"},
					// { icon: "icon-shouji", title: "实名认证",route: "/pages/authen/authen?user=2", show: false},
					{ icon: "icon-xiaoxi", title: "问题反馈", route: "/pages/questen/questen"},
					{ icon: "icon-location", title: "服务地址", route: "/pages/address/address"},
					{ icon: "icon-shop1170559easyiconnet", title: "商家入驻", route: "/pages/authen/authen?user=1"},
					{ icon: "icon-xieyi", title: "用户协议", route: "/pages/xieyi/xieyi"},
					{ icon: "icon-star", title: "我要成为创客", route: "/pages/chuangke/chuangke"},
					{ icon: "icon-yonghu", title: "我的推荐人", route: "/pages/tuijian/tuijian"},
					{ icon: "icon-shezhi", title: "我的客户", route: "/pages/mypeople/mypeople"},
					
				]
			}
		},
		props:{
			isauth:Boolean
		},
		mounted() {
			// this.isShowAuth()
		},
		watch:{
			isauth() {
				// this.isShowAuth()
			},
		},
		methods:{
			// 是否实名
			isShowAuth() {
				// console.log(this.isauth);
				if(this.isauth) {
					this.setList.forEach( (el, index) => {
						if(el.title == "实名认证") {
							this.setList.splice(index, 1)
						}
					})
				}
			},
			onChange( val ) {
				// console.log(val);
				uni.navigateTo({
					url: val.route,
					fail( er ) {
						console.log(er);
					}
				})
			},
		},
		updated() {
			this.isShowAuth()
		},
	}
</script>

<style lang="scss" scoped>
	.user_set {
		width: 100%;
		box-sizing: border-box;
		.set_item {
			width: 100%;
			padding: 20rpx 30rpx;
			background-color: #f2f2f2;
			box-sizing: border-box;
			.item {
				width: 100%;
				box-sizing: border-box;
				display: flex;
				align-items: center;
				 justify-content: space-between;
				 .set_iconright {
					 color: #007AFF;
				 }
				.left {
					display: flex;
					.set_icon {
						color: #007AFF;
					}
					.set_title {
						margin-left: 30rpx;
					}
				}
			}
		}
	}
</style>
